import React, {
  Ref,
  useCallback,
  useContext,
  useEffect,
  useMemo,
  useRef,
  useState,
} from 'react';
import { OneModal } from '@/components/one-ui';
import {
  getCompanyID,
  getPosIDs,
  getTenantID,
  getUserDepID,
  getUserID,
} from '@/utils';
import {
  Form,
  Input,
  Radio,
  DatePicker,
  InputNumber,
  message,
  Spin,
} from 'antd';
import moment from 'moment';
import Cron from './cron';
import pageStyles from '@/common/pageLayout.less';
import { UploadOutlined, UserOutlined } from '@ant-design/icons';
import {
  addNotifyService,
  editNotifyService,
  editNotifyServiceadd,
} from '../services';
import BeRemindedPeople from './beRemindedPeople';
import '../common/index.less';
import { IActionEnum, RemindPeopleContext } from '../common';
import { UploadFormCommon } from '@/components/UploadForm';
const TodayDatePicker: any = DatePicker;
export default function RemindManageAdd(props: any) {
  const {
    updateDispath,
    leftSelectKeys, //部门id
    centreUserRows, //人集合
    joinCheckBoxKeys, //选中人id集合
  } = useContext(RemindPeopleContext);
  /**判断是否是编辑   flag==true 是编辑   id是编辑用户的id**/
  const [editFlags, setEditFlags]: any = useState();
  /**编辑回显使用的state*/
  const [editFileUrl, setEditFileUrl] = useState<string | null>(null);
  // form表单的字段
  const [alertForm, setAlertFrom]: any = useState({
    notifyType: `${getTenantID()}14011000`, //提醒类型
    notifyStyle: 0, //提醒方式
    startTime: moment(), //开始时间
    endTime: moment(new Date().toLocaleDateString()).add(1, 'days'), //结束时间
    notifyContent: '', //提醒内容
    notifyCount: 0, // 提醒次数
    mnotifyReceiveList: '', //被提醒人信息
    attachUrl: '', // 相关附件，多个使用||分隔，最多传五个,
    notifyIdsove: 0,
  });
  /**loading**/
  // const [loadings, setLoading] = useState: (false)
  const [remindedPeople, setRemindedPeople] = useState<boolean>(false);
  /**关闭弹窗**/
  const addRemindModalRef: any = useRef(null);
  const onCloseModal = () => {
    if (addRemindModalRef) {
      if (addRemindModalRef.current) {
        if (addRemindModalRef.current.onModalCancel) {
          addRemindModalRef.current.onModalCancel();
        }
      }
    }
  };
  /**编辑先查看该的回调*/
  const editCallback = useCallback((res) => {
    if (res && res?.msgFlag) {
      message.success(res.msg);
      let initobj: any = alertForm;
      let editobj = res?.obj;
      for (let key in initobj) {
        initobj[key] = editobj[key];
      }
      /**将时间格式改变一下*/
      initobj.startTime = moment(initobj?.startTime);
      initobj.endTime = moment(initobj?.endTime);
      /**判断一下提醒自己还是提醒他人**/
      /** 保存到form表单中*/
      if (editobj.expandDisplay !== null) {
        initobj.mnotifyReceive = 1;
        setForms('notifyIdsove', 1);
        updateDispath({
          type: IActionEnum.LEFTSELECT_KEYS,
          payload: editobj?.expandDisplay?.leftSelectKeys,
        });
        updateDispath({
          type: IActionEnum.SAVE_USER_LIST,
          payload: editobj?.expandDisplay?.centreUserRows,
        });
        updateDispath({
          type: IActionEnum.CENTRE_CHECKBOX_KEYS,
          payload: editobj?.expandDisplay?.joinCheckBoxKeys,
        });
        initobj.joinIdsText = `已选择 ${editobj?.expandDisplay?.joinCheckBoxKeys?.length} 位提醒人员`;
      }
      addForm.setFieldsValue({ ...initobj });
      setAlertFrom({ ...alertForm, notifyStyle: initobj.notifyStyle });
      setEditFileUrl(res?.obj?.attachUrl);
    } else {
      message.error(res?.msg);
    }
  }, []);
  /**编辑接口**/
  const editsCallback = (res: any) => {
    if (res && res?.msgFlag) {
      message.success(res.msg);
      props?.refreshRequest();
      onCloseModal();
    } else {
      message.error(res?.msg);
    }
  };
  const { editNotifyLoading, editNotifyRun } = editNotifyService(editCallback);
  useMemo(() => {
    setEditFlags(props?.editState);
    if (props?.editState?.flag) {
      /**点击的是编辑----接口请求数据**/
      editNotifyRun({
        id: props?.editState?.id,
        viewerID: getUserID(),
        viewPositionID: getPosIDs(),
        viewDepartmentID: getUserDepID(),
        viewCompanyID: getCompanyID(),
      });
    }
  }, [props?.editState]);
  //
  const [addForm] = Form.useForm();
  // 被提醒人 flag
  const [arrFlag, setflag] = useState({
    remindedPeople: true, //被提醒人
    setStartTime: false, //开始时间
    setcronflag: false, //cron弹窗
  });
  const [cron, setcron] = useState({
    s: 0,
    f: 0,
    m: 0,
  });
  const updateCallback = (res: any, urlType: boolean) => {
    if (res && res?.msgFlag) {
      message.success(res.msg);
      props?.refreshRequest();
      onCloseModal();
      updateDispath({
        type: IActionEnum.LEFTSELECT_KEYS,
        payload: [],
      });
      updateDispath({
        type: IActionEnum.SAVE_USER_LIST,
        payload: [],
      });
      updateDispath({
        type: IActionEnum.CENTRE_CHECKBOX_KEYS,
        payload: [],
      });
      updateDispath({
        type: IActionEnum.LEFTEXPANDED_KEYS,
        payload: [],
      });
    } else {
      message.error(res?.msg);
    }
  };
  /**新增接口*/
  const { addNotifyLoading, addNotifyRun } = addNotifyService(updateCallback);
  /**编辑接口*/
  const { editsNotifyLoading, editsNotifyRun } = editNotifyServiceadd(
    editsCallback,
  );
  let [dataList, setData] = useState('');
  function setdata(val: string) {
    setData(val);
  }
  function handleClick() {
    //弹窗的确定按钮
    setflag({ ...arrFlag, setcronflag: false }); //关闭弹窗
    setForms('notifyStyle', 2);
  }
  function handleCancel() {
    setflag({ ...arrFlag, setcronflag: false }); //关闭弹窗
    setForms('notifyStyle', 0); // 将选中复杂的按钮取消 换成第一个
    addForm.setFieldValue('notifyStyle', 0);
  }
  function setTimer(e: any, flag: boolean) {
    //处理时间
    let now;
    if (flag) {
      now = new Date(e);
    } else {
      let n = 86400000;
      let nez = new Date().getTime();
      nez += n * e;
      now = new Date(nez);
    }
    let year = now.getFullYear(); //年
    let month = now.getMonth() + 1; //月
    let day = now.getDate(); //日
    let hh = now.getHours(); //时
    let mm = now.getMinutes(); //分
    let s = now.getSeconds(); //秒
    if (month < 10) month = Number('0' + month);
    if (day < 10) day = Number('0' + day);
    if (hh < 10) hh = Number('0' + hh);
    if (mm < 10) mm = Number('0' + mm);
    if (s < 10) s = Number('0' + s);
    let clock = year + '-' + month + '-' + day + ' ' + hh + ':' + mm + ':' + s;
    return clock;
  }
  //禁用当前之前日期
  function disabledDate(current: any) {
    // const result = current && current < moment(new Date()).add(-1, 'days');
    const result = current && current < moment().subtract(1, 'days');
    return result;
  }
  // 计算多次时间        1            s
  function changeCron(val: number, e: string) {
    // 结束 - 开始 = 间隔
    let startTimeMM = new Date(alertForm.startTime).getTime();
    let endTimeMM = new Date(alertForm.endTime).getTime();
    let interval = Number(endTimeMM - startTimeMM) / 1000;
    let notifyCount: any;
    if (e == 's') {
      setcron({ ...cron, s: Number(val) });
      if (val === 0 && cron.f === 0 && cron.m === 0) {
        notifyCount = 0;
      } else {
        notifyCount = Math.floor(
          interval / (val * 3600 + cron.f * 60 + cron.m),
        );
      }
    }
    if (e == 'f') {
      setcron({ ...cron, f: Number(val) });
      if (val === 0 && cron.s === 0 && cron.m === 0) {
        notifyCount = 0;
      } else {
        notifyCount = Math.floor(
          interval / (cron.s * 3600 + val * 60 + cron.m),
        );
      }
    }
    if (e == 'm') {
      setcron({ ...cron, m: Number(val) });
      if (val === 0 && cron.s === 0 && cron.f === 0) {
        notifyCount = 0;
      } else {
        notifyCount = Math.floor(
          interval / (cron.s * 3600 + cron.f * 60 + val),
        );
      }
    }
    setAlertFrom({ ...alertForm, notifyCount });
    addForm.setFieldsValue({ notifyCount: notifyCount });
  }
  /**hoursOneNum(小时)  minuteOneNum(分钟)  secondOneNum(秒数)**/
  function setIntervalOneNum(flag: string, e: any) {
    let endTimeMM = moment(
      addForm.getFieldValue('endTime').format('YYYY-MM-DD HH:mm:ss'),
    ).valueOf();
    let startTimeMM = endTimeMM;
    if (flag == 's') {
      setcron({ ...cron, s: Number(e) });
      if (e == 0 && cron.f == 0 && cron.m == 0) {
        startTimeMM = endTimeMM;
      } else {
        startTimeMM =
          endTimeMM - (e * 60 * 60 * 1000 + cron.f * 60 * 1000 + cron.m * 1000);
      }
    } else if (flag == 'f') {
      setcron({ ...cron, f: Number(e) });
      if (e == 0 && cron.s == 0 && cron.m == 0) {
        startTimeMM = endTimeMM;
      } else {
        startTimeMM =
          endTimeMM - (cron.s * 60 * 60 * 1000 + e * 60 * 1000 + cron.m * 1000);
      }
    } else if (flag == 'm') {
      setcron({ ...cron, m: Number(e) });
      if (e == 0 && cron.s == 0 && cron.f == 0) {
        startTimeMM = endTimeMM;
      } else {
        startTimeMM =
          endTimeMM - (cron.s * 60 * 60 * 1000 + cron.f * 60 * 1000 + e * 1000);
      }
    }
    let startTime = setTimer(startTimeMM, true);
    setAlertFrom({ ...alertForm, startTime });
  }
  /**修改alertForm表单值*/
  const setForms = (str: string, num: string | number) => {
    let obj: any = alertForm;
    obj[str] = num;
    setAlertFrom({ ...obj });
  };
  useEffect(() => {
    if (cron.s !== 0) {
      changeCron(cron.s, 's');
    } else if (cron.f !== 0) {
      changeCron(cron.f, 'f');
    } else if (cron.m !== 0) {
      changeCron(cron.m, 'm');
    }
  }, [alertForm.startTime, alertForm.endTime]);
  const beremind = () => {
    addForm.setFieldValue('notifyIdsove', 0);
    setRemindedPeople(false);
  };
  /**计算时间 notifyInterval**/
  const computedTime = () => {
    let sum = 0;
    let hourNum = cron.s * 1000 * 60 * 60;
    let minuteNum = cron.f * 1000 * 60;
    let secondNum = cron.m * 1000;
    sum += hourNum + minuteNum + secondNum;
    return sum;
  };
  return (
    <div>
      <OneModal
        ref={addRemindModalRef}
        confirmLoading={
          editsNotifyLoading || addNotifyLoading || editNotifyLoading
        }
        title={editFlags && editFlags.flag ? '编辑提醒' : '添加提醒'}
        onOk={() => {
          addForm?.validateFields()?.then((values: any) => {
            /**如果提交的notifyStyle是0  说明是单次提醒 手动加上startTime notifyCount**/
            if (values?.hasOwnProperty('notifyInterval')) {
              values.notifyInterval = computedTime();
            }
            values.createrID = getUserID();
            values.createPositionID = getPosIDs();
            values.createDepartmentID = getUserDepID();
            values.createCompanyID = getCompanyID();
            values.startTime = moment(values.startTime)
              .format('YYYY-MM-DD HH:mm:ss')
              .valueOf();
            values.endTime = moment(values.endTime)
              .format('YYYY-MM-DD HH:mm:ss')
              .valueOf();
            /**单次提醒**/
            if (values?.notifyStyle == '0') {
              values.notifyCount = '1';
              values.paramObject = {
                quartzType: values?.notifyType,
                jobClassName: 'cn.onefox.job.QuartzDoJobs',
              };
              if (cron.s == 0 && cron.f == 0 && cron.m == 0) {
                values.startTime = values.endTime;
                // return;
              } else {
                values.startTime = moment(alertForm.startTime)
                  .format('YYYY-MM-DD HH:mm:ss')
                  .valueOf();
              }

              /** 多次提醒 */
            } else if (values?.notifyStyle == '1') {
              values.paramObject = {
                endTime: values?.endTime,
                startTime: values?.startTime,
                executeInterval: values?.notifyInterval,
                executeStyle: 0,
                quartzType: values?.notifyType,
                jobClassName: 'cn.onefox.job.QuartzDoJobs',
              };

              /**复杂提醒**/
            } else if (values?.notifyStyle == '2') {
              values.paramObject = {
                executeStyle: 1,
                cronExpression: dataList,
                quartzType: values.notifyType,
                jobClassName: 'cn.onefox.job.QuartzDoJobs',
              };
              delete values.startTime;
              delete values.endTime;
              values.cronExpression = dataList;
            }
            /**提醒自己**/
            if (values?.mnotifyReceive == '0') {
              values.mnotifyReceiveList = [
                {
                  receiverID: getUserID(),
                  notifyederID: getUserID(),
                  notifyedPositionID: getPosIDs(),
                  notifyedDepartmentID: getCompanyID(),
                },
              ];
            } else {
              /**提醒他人**/
              values.expandDisplay = {
                leftSelectKeys,
                centreUserRows,
                joinCheckBoxKeys,
              };
              values.mnotifyReceiveList = [
                {
                  receiverID: getUserID(),
                  notifyederID: getUserID(),
                  notifyedPositionID: getPosIDs(),
                  notifyedDepartmentID: getCompanyID(),
                },
              ];
            }
            delete values?.mnotifyReceive;
            delete values?.joinIdsText;
            let obj = values;
            /**判断新增还是编辑**/
            if (editFlags.flag) {
              obj.id = props?.editState.id;
              obj.versionNum = props?.editState.versionNum;
              obj.oldNotifyStyle = props?.editState.notifyStyle;
              editsNotifyRun(obj);
              return;
            } else {
              if (values?.notifyStyle == '1') {
                if (
                  new Date(values.startTime).getTime() < new Date().getTime() ||
                  new Date(values.endTime).getTime() < new Date().getTime()
                ) {
                  message.error(
                    '该提醒的开始/结束时间小于当前的时间, 请重新选择',
                  );
                  return;
                }
              }
            }
            /**备忘录*/
            if (values?.notifyType == props?.arr[2].id) {
              values.mnotifyReceiveList = [
                {
                  receiverID: getUserID(),
                  notifyederID: getUserID(),
                  notifyedPositionID: getPosIDs(),
                  notifyedDepartmentID: getCompanyID(),
                },
              ];
              values.expandDisplay = null;
            }
            // console.log("新增提醒", obj)
            addNotifyRun(obj);
          });
        }}
        onCancel={() => {
          props.onClose();
          updateDispath({
            type: IActionEnum.LEFTSELECT_KEYS,
            payload: [],
          });
          updateDispath({
            type: IActionEnum.SAVE_USER_LIST,
            payload: [],
          });
          updateDispath({
            type: IActionEnum.CENTRE_CHECKBOX_KEYS,
            payload: [],
          });
          updateDispath({
            type: IActionEnum.LEFTEXPANDED_KEYS,
            payload: [],
          });
        }}
        open={true}
        centered={true}
        transitionName=""
        width={700}
        bodyStyle={{
          padding: 0,
        }}
      >
        <div className={pageStyles['fromView-styles']}>
          <div className="remindAddform">
            <Spin
              spinning={
                editsNotifyLoading || addNotifyLoading || editNotifyLoading
              }
            >
              <Form form={addForm}>
                <Form.Item
                  name="notifyType"
                  label="提醒类型"
                  rules={[{ required: true, message: '请选择提醒类型' }]}
                  initialValue={alertForm.notifyType}
                >
                  <Radio.Group
                    onChange={(e) => {
                      setForms('notifyType', e.target.value);
                      if (e.target.value == `${getTenantID()}14011002`) {
                        setflag({ ...arrFlag, remindedPeople: false });
                      } else {
                        setflag({ ...arrFlag, remindedPeople: true });
                      }
                    }}
                  >
                    {props?.arr &&
                      props?.arr.map((item: any, index: number) => {
                        return (
                          <Radio key={item.id} value={item.id}>
                            {item.name}
                          </Radio>
                        );
                      })}
                  </Radio.Group>
                </Form.Item>
                <Form.Item
                  name="notifyStyle"
                  label="提醒方式"
                  rules={[{ required: true, message: '请选择提醒方式' }]}
                  initialValue={alertForm.notifyStyle}
                >
                  <Radio.Group
                    value={alertForm.notifyStyle}
                    // disabled={editFlags && editFlags.flag}
                    onChange={(e) => {
                      setForms('notifyStyle', e.target.value);
                      if (e.target.value == 1) {
                        setflag({ ...arrFlag, setStartTime: true });
                      } else {
                        setflag({ ...arrFlag, setStartTime: false });
                      }
                      if (e.target.value == 2) {
                        setflag({ ...arrFlag, setcronflag: true });
                      }
                    }}
                  >
                    <Radio value={0}>单次提醒</Radio>
                    <Radio value={1}>多次提醒</Radio>
                    <Radio value={2}>复杂提醒</Radio>
                  </Radio.Group>
                </Form.Item>
                {alertForm.notifyStyle == '1' &&
                arrFlag.setcronflag !== true ? (
                  <Form.Item
                    name="startTime"
                    label="开始时间"
                    initialValue={alertForm.startTime}
                    rules={[{ required: true, message: '请选择开始时间' }]}
                  >
                    <TodayDatePicker
                      showTime
                      format="YYYY-MM-DD HH:mm:ss"
                      style={{ width: '100%' }}
                      onChange={(e: any) => {
                        if (e === null) {
                          return;
                        }
                        let startTime = moment(
                          addForm
                            .getFieldValue('startTime')
                            .format('YYYY-MM-DD HH:mm:ss'),
                        ).valueOf();
                        let endTime = moment(
                          addForm
                            .getFieldValue('endTime')
                            .format('YYYY-MM-DD HH:mm:ss'),
                        ).valueOf();
                        if (
                          new Date(startTime).getTime() < new Date().getTime()
                        ) {
                          addForm.setFieldsValue({ startTime: moment() });
                          return message.error('开始时间不能低于当前时间');
                        }
                        if (endTime < startTime) {
                          message.error('请输入正确的时间');
                          addForm.setFieldsValue({
                            startTime: alertForm.startTime,
                            endTime: moment(
                              new Date().toLocaleDateString(),
                            ).add(1, 'days'),
                          });
                          return;
                        } else {
                          let str = setTimer(e, true);
                          setForms('startTime', str);
                        }
                      }}
                      disabledDate={disabledDate}
                      popupClassName={pageStyles['datePickerTimeScrollbar']}
                    />
                  </Form.Item>
                ) : (
                  ''
                )}
                {alertForm.notifyStyle == '0' ||
                alertForm.notifyStyle == '1' ? (
                  <Form.Item
                    name="endTime"
                    label="结束时间"
                    initialValue={moment(new Date().toLocaleDateString()).add(
                      1,
                      'days',
                    )}
                    rules={[{ required: true, message: '请选择结束时间' }]}
                  >
                    <TodayDatePicker
                      showTime
                      format="YYYY-MM-DD HH:mm:ss"
                      style={{ width: '100%' }}
                      onChange={(e: any) => {
                        if (e === null) {
                          return;
                        }
                        let endTime = moment(
                          addForm
                            .getFieldValue('endTime')
                            .format('YYYY-MM-DD HH:mm:ss'),
                        ).valueOf();
                        if (
                          new Date(endTime).getTime() < new Date().getTime()
                        ) {
                          addForm.setFieldsValue({
                            endTime: moment(
                              new Date().toLocaleDateString(),
                            ).add(1, 'days'),
                          });
                          return message.error('结束时间不能低于当前时间');
                        }
                        let str = setTimer(e, true);
                        setForms('endTime', str);
                      }}
                      disabledDate={disabledDate || alertForm.startTime}
                      popupClassName={pageStyles['datePickerTimeScrollbar']}
                    />
                  </Form.Item>
                ) : (
                  ''
                )}
                {alertForm?.notifyStyle == '0' &&
                arrFlag.setcronflag !== true ? (
                  <Form.Item label={'提前设置'}>
                    <div className="ant-input-affix-wap">
                      <InputNumber
                        defaultValue={cron.s}
                        min={0}
                        onChange={(e) => {
                          setIntervalOneNum('s', e);
                        }}
                      ></InputNumber>
                      <span>时</span>
                      <InputNumber
                        defaultValue={cron.f}
                        min={0}
                        onChange={(e) => {
                          setIntervalOneNum('f', e);
                        }}
                      ></InputNumber>
                      <span>分</span>
                      <InputNumber
                        defaultValue={cron.m}
                        min={0}
                        onChange={(e) => {
                          setIntervalOneNum('m', e);
                        }}
                      ></InputNumber>
                      <span>秒</span>
                    </div>
                  </Form.Item>
                ) : (
                  ''
                )}
                {alertForm?.notifyStyle == '1' &&
                arrFlag.setcronflag !== true ? (
                  <Form.Item name="notifyInterval" label={'提醒间隔'}>
                    <div className="ant-input-affix-wap">
                      <InputNumber
                        defaultValue={cron.s}
                        min={0}
                        onChange={(e) => {
                          changeCron(e, 's');
                        }}
                      ></InputNumber>
                      <span>时</span>
                      <InputNumber
                        defaultValue={cron.f}
                        min={0}
                        onChange={(e) => {
                          changeCron(e, 'f');
                        }}
                      ></InputNumber>
                      <span>分</span>
                      <InputNumber
                        defaultValue={cron.m}
                        min={0}
                        onChange={(e) => {
                          changeCron(e, 'm');
                        }}
                      ></InputNumber>
                      <span>秒</span>
                    </div>
                  </Form.Item>
                ) : (
                  ''
                )}
                {alertForm.notifyStyle == '1' &&
                arrFlag.setcronflag !== true ? (
                  <Form.Item
                    name="notifyCount"
                    label="提醒次数"
                    initialValue={alertForm.notifyCount}
                  >
                    <InputNumber disabled></InputNumber>
                  </Form.Item>
                ) : (
                  ''
                )}
                <Form.Item
                  name="notifyContent"
                  label="提醒内容"
                  rules={[{ required: true, message: '请填写提醒内容' }]}
                  initialValue={alertForm.notifyContent}
                >
                  <Input.TextArea
                    autoSize={{ minRows: 3, maxRows: 4 }}
                    placeholder="请输入提醒内容"
                    allowClear
                    showCount
                    maxLength={400}
                    onChange={(e) => {
                      setForms('notifyContent', e.target.value);
                    }}
                  />
                </Form.Item>
                {arrFlag.remindedPeople &&
                alertForm.notifyType !== `${getTenantID()}14011002` ? (
                  <Form.Item
                    label="被提醒人"
                    name={'mnotifyReceive'}
                    initialValue={0}
                  >
                    <Radio.Group
                      onChange={(e) => {
                        setForms('notifyIdsove', e.target.value);
                      }}
                    >
                      <Radio value={0} key={0}>
                        {' '}
                        提醒自己{' '}
                      </Radio>
                      <Radio value={1} key={1}>
                        {' '}
                        提醒他人{' '}
                      </Radio>
                    </Radio.Group>
                  </Form.Item>
                ) : (
                  ''
                )}
                {alertForm.notifyIdsove == 1 &&
                alertForm.notifyType !== `${getTenantID()}14011002` ? (
                  <Form.Item label="被提醒人" name={'joinIdsText'}>
                    <Input
                      disabled
                      placeholder="请选择被提醒人"
                      addonAfter={
                        <UserOutlined
                          onClick={() => {
                            setRemindedPeople(true);
                          }}
                        />
                      }
                    />
                  </Form.Item>
                ) : (
                  ''
                )}
                <UploadFormCommon
                  form={addForm}
                  fileFormName={'attachUrl'}
                  spanCol={24}
                  inRowProportion={12}
                  name={'attachFile'}
                  label="上传附件"
                  required={false}
                  accept={'.jpg|.png|.jpeg|.doc|.docx'}
                  url={'/notifyController/uploadFile'}
                  downloadUrl={'/notifyController/downloadFile'}
                  fileFormDelName={'delLicenceUrl'}
                  delFunc={() => {}}
                  maxFile={5}
                  defaultFiles={
                    props?.editState?.flag
                      ? editFileUrl !== null
                        ? editFileUrl
                        : null
                      : alertForm && alertForm?.id
                      ? alertForm?.attachUrl
                      : null
                  }
                >
                  上传附件
                </UploadFormCommon>
              </Form>
            </Spin>
          </div>
        </div>
      </OneModal>
      {arrFlag.setcronflag ? (
        <Cron
          handleClick={handleClick}
          handleCancel={handleCancel}
          cronState={setdata}
        />
      ) : (
        false
      )}
      {remindedPeople ? (
        <BeRemindedPeople
          onChange={beremind}
          updateForm={addForm}
        ></BeRemindedPeople>
      ) : null}
    </div>
  );
}
